FROM quay.io/pypa/manylinux2014_aarch64

ENV bisheng_name=BiShengCompiler-4.1.0-aarch64-linux

RUN echo "export LS_OPTIONS='--color=auto'" >> ~/.bashrc ;\
    echo "PS1='\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\[\033[00m\]\[\033[01;33m\]容器内@\[\033[00m\]\[\033[01;35m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\\\$ '" >> ~/.bashrc ;\
    echo "alias rm='rm -i'" >> ~/.bashrc ;\
    echo "alias cp='cp -i'" >> ~/.bashrc ;\
    echo "alias mv='mv -i'" >> ~/.bashrc ;\
    echo "alias ls='ls \$LS_OPTIONS'" >> ~/.bashrc ;\
    echo "alias ll='ls \$LS_OPTIONS -l'" >> ~/.bashrc ;\
    echo "alias l='ls \$LS_OPTIONS -lA'" >> ~/.bashrc ;\
    echo "alias lm='ls | xargs stat -c \"%A %a %U:%G=(%u:%g) %w %n \" '" >> ~/.bashrc ;\
    echo "export CC=clang" >> ~/.bashrc ;\
    echo "export C=clang" >> ~/.bashrc ;\
    echo "export CXX=clang++" >> ~/.bashrc

    # COPY ./BiShengCompiler/$bisheng_name.tar.gz /root
    # cp /root/$bisheng_name.tar.gz /root/.cache/docker_builer

RUN --mount=type=cache,target=/root/.cache/docker_builer,id=cache_package \
    echo ${bisheng_name} ;\
    mkdir -p /opt/compiler ;\
    tar -zxvf /root/.cache/docker_builer/${bisheng_name}.tar.gz -C /opt/compiler/ ;\
    echo "export BishengPath=/opt/compiler/${bisheng_name}" >> ~/.bashrc ;\
    echo "export PATH=\$BishengPath/bin:\$PATH" >> ~/.bashrc ;\
    echo "export LD_LIBRARY_PATH=\$BishengPath/lib:\$BishengPath/lib/aarch64-unknown-linux-gnu:\$LD_LIBRARY_PATH" >> ~/.bashrc ;\
    source ~/.bashrc ;\
    hash -r ;\
    clang -v

RUN yum install -y wget tar gzip

RUN --mount=type=cache,target=/root/.cache/pip,id=pip \
    python3.7 -m pip install --upgrade pip ;\
    python3.8 -m pip install --upgrade pip ;\
    python3.9 -m pip install --upgrade pip ;\
    python3.10 -m pip install --upgrade pip ;\
    python3.7 -m pip install pyyaml ;\
    python3.8 -m pip install pyyaml ;\
    python3.9 -m pip install pyyaml ;\
    python3.10 -m pip install pyyaml



#! 配置毕昇编译器